//
//  CaseTableViewCell3.m
//  LiangYa_BObject
//
//  Created by dllo on 15/10/30.
//  Copyright © 2015年 YuHao. All rights reserved.
//

#import "CaseTableViewCell3.h"
#import "CaseCollectionViewCell2.h"
@implementation CaseTableViewCell3

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.imagesArr = [NSMutableArray array];
        
        self.mylabel= [[NightLabel alloc] init];
        [self.contentView addSubview:self.mylabel];
        
        
        self.flowLayout = [[UICollectionViewFlowLayout alloc] init];
        //        _flowLayout.itemSize = CGSizeMake(100*_a, 100*_a);
        //        _flowLayout.sectionInset = UIEdgeInsetsMake(15*_a, 15*_a, 15*_a, 15*_a);
        
        self.flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 114, self.contentView.bounds.size.width, self.contentView.bounds.size.height - 114) collectionViewLayout:_flowLayout];
        _collectionView.delegate = self;
        _collectionView.dataSource = self;
        _collectionView.backgroundColor = [UIColor clearColor];
        _collectionView.showsHorizontalScrollIndicator = NO;
        [self.contentView addSubview:_collectionView];
        
     
        [_collectionView registerClass:[CaseCollectionViewCell2 class] forCellWithReuseIdentifier:@"DetailDate11"];
        
              
        
        
    }
    return self;
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
        return _imagesArr.count;
    
}

- (void)setImagesArr:(NSMutableArray *)imagesArr
{
    if (_imagesArr != imagesArr) {
        _imagesArr = imagesArr;
        
        [self.collectionView reloadData];
    }
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    
//    [self.Deledate passValue1:_imagesArr number:indexPath.row name:_name];
    [self.Deledate passValue1:self.imagesArr number:indexPath.row name:self.name];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    CaseCollectionViewCell2 *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"DetailDate11" forIndexPath:indexPath];
    NSString *str = [_imagesArr objectAtIndex:indexPath.row];
    [cell.myimageview sd_setImageWithURL:[NSURL URLWithString:str]placeholderImage:[UIImage imageNamed:@"baikejiaju.png"]];
    return cell;
    
    
    
}






- (void) layoutSubviews
{
    
    [super layoutSubviews];
     self.backgroundColor = [UIColor clearColor];
    self.mylabel.frame = CGRectMake(10, 5, 100, 25);
    _flowLayout.itemSize = CGSizeMake(100, 100);
    _flowLayout.sectionInset = UIEdgeInsetsMake(0, 5, 0, 10);
    
    _collectionView.frame = CGRectMake(0 , 30, cellWidth, cellHeight - 30);
    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
